<?php
require_once(dirname(__FILE__)."/../../libs/login/login.php");  
require_once(dirname(__FILE__)."/../../libs/dbclass/dbconnect.php");
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");

$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
$mc=new libstr();

?>


<?php
$url=$_GET["url"];
$id=$_GET["id"];
$gl=$db->dvstr("select * from guanlian_class where ID=".$id);
function sda($strr){
	$mystr="0,";
	global $mc,$db;
	$sqlstr="select * from guanlian_class where ID=".trim($strr)." order by ID asc ";
	$rs1=$db->ds($sqlstr);
	$rowcount=count($rs1);
	if($rowcount>0){
		$mystr=trim($rs1[0]["rootid"]);
	}
	return $mystr;
}

if (isset($_POST["Submit"])&&$_POST["Submit"]!="")
{
	if ($_POST["classname"]==""){$mc->msg("类别不能为空","go");}
	$sqlcheck="select * from guanlian_class where classname='".trim($_POST["classname"])."' and ID!=".$id." ";
	$mysql=$db->dvstr($sqlcheck);
	if($mysql!=0){$mc->msg("对不起，你添加的名称已存在","go");}
	

	$db->cmd("update guanlian_class set classname='".trim($_POST["classname"])."' where ID=".$id."");
	$mc->msg("",$url.".php?page=".$_GET["page"]."");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="../css/Admin_Style.css" rel="stylesheet" type="text/css">

</head>

<body >
<form name="form1" method="post" action="">

  <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="5"></td>
    </tr>
  </table>
  <table width="98%" height="100" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td width="13%"><div align="right">类别名称：</div></td>
      <td width="87%"><input name="classname" type="text" id="classname" value="<?php echo $gl["classname"];?>" style="width:98%"></td>
    </tr>
    <tr> 
      <td><div align="right"></div></td>
      <td><input type="submit" name="Submit" value="提交">
        <input type="button" name="Submit2" value="返回" onClick="location.href='<?php echo $url?>.php?page=<?php echo $_GET["page"]?>'"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
